package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.SimbaCampaignUpdateResponse;

/**
 * TOP API: taobao.simba.campaign.update request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class SimbaCampaignUpdateRequest implements TaobaoRequest<SimbaCampaignUpdateResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 推广计划Id
   */
  private Long                campaignId;

  /**
   * 主人昵称
   */
  private String              nick;

  /**
   * 用户设置的上下限状态；offline-下线；online-上线；
   */
  private String              onlineStatus;

  /**
   * 推广计划名称，不能多余20个字符，不能和客户其他推广计划同名。
   */
  private String              title;

  public void setCampaignId(Long campaignId) {
    this.campaignId = campaignId;
  }

  public Long getCampaignId() {
    return this.campaignId;
  }

  public void setNick(String nick) {
    this.nick = nick;
  }

  public String getNick() {
    return this.nick;
  }

  public void setOnlineStatus(String onlineStatus) {
    this.onlineStatus = onlineStatus;
  }

  public String getOnlineStatus() {
    return this.onlineStatus;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getTitle() {
    return this.title;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.simba.campaign.update";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("campaign_id", this.campaignId);
    txtParams.put("nick", this.nick);
    txtParams.put("online_status", this.onlineStatus);
    txtParams.put("title", this.title);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<SimbaCampaignUpdateResponse> getResponseClass() {
    return SimbaCampaignUpdateResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkNotEmpty(campaignId, "campaignId");
    RequestCheckUtils.checkNotEmpty(onlineStatus, "onlineStatus");
    RequestCheckUtils.checkNotEmpty(title, "title");
    RequestCheckUtils.checkMaxLength(title, 20, "title");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
